package com.fupan.DeadLetter;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.IOException;

@Component
public class Listener {

    @RabbitListener(queues = "deadLetterQueue")
    public void onMsg(String msg, Channel channel, Message message) throws IOException {

        System.out.println("DeadLetterQueryConsumer : " + msg);

        channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);

    }

}
